package shared

import (
	"go.uber.org/zap"
)

const (
	AppID = "bp"
	OutAppIDOfMall = "mall"
	OutAppIDOfPay = "pay"
)

var (
	NsqLogger *NoopNSQLogger
)

// NoopNSQLogger allows us to pipe NSQ logs to dev/null
// The default NSQ logger is great for debugging, but did
// not fit our normally well structured JSON logs. Luckily
// NSQ provides a simple interface for injecting your own
// logger.
type NoopNSQLogger struct {
	slog *zap.SugaredLogger
}

func NewNoopNSQLogger(
	slog *zap.SugaredLogger,
) *NoopNSQLogger {
	return &NoopNSQLogger{slog: slog}
}

// Output allows us to implement the nsq.Logger interface
func (l *NoopNSQLogger) Output(calldepth int, s string) error {
	l.slog.Errorf("nsqerr:%s", s)
	return nil
}

